<!doctype html>
<html>
<head>
<meta charset="utf-8">
    <title>新闻公告</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">     
    <meta content="yes" name="apple-mobile-web-app-capable">     
    <meta content="black" name="apple-mobile-web-app-status-bar-style">     
    <meta content="telephone=no" name="format-detection">
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/H5/css/sm.min.css" />
    <link rel="stylesheet" type="text/css" href="/H5/css/reset.css" />
</head>            
<body>
	<div class="page-group ms-controller" :controller="notice">
        <div class="page page-current">
            <header class="bar bar-nav">
              	<a class="icon icon-left pull-left" href="javascript:window.history.go(-1);"></a>
              	<a class="icon icon-home pull-right" href="/H5"></a>
              	<h1 class="title">新闻公告</h1>
            </header>
            <div class="content infinite-scroll infinite-scroll-bottom" data-distance="100">
                <div class="list-block" style="margin: 1rem 0 1.75rem 0;" :if="@list.length>0">
    			    <ul>
						<li class="item-content item-link" :for="el in @list">
							<div class="item-media"><i class="icon icon-f7"></i></div>
							<a :attr="{'href': '/H5/articledetial?noticeId='+el.id }" class="item-inner">
								<div class="item-title">{{el.title}}</div>
								<div class="item-after article-time">{{el.create_time.split(" ")[0]}}</div>
							</a>
						</li>
					</ul>
				</div>
                <div :if="@more" class="infinite-scroll-preloader">
	                <div class="preloader"></div>
	            </div>
            </div>
        </div>
    </div>
<script type='text/javascript' src='/H5/js/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/avalon.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/simpleStorage.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/mall.js' charset='utf-8'></script>
<script>
	var notice = avalon.define({
		$id: "notice",
		list: [],
		loading: false,
		more: false,
		page_num: 1,
		page_size: 20,
		getArticle: function( t ){
			if( notice.loading ){
				return
			}
			notice.loading = true;
			Mall.request( "/api/ArticleList", {cate: "notice", page_num: notice.page_num, page_size: notice.page_size} )
				.always( function( data ){
					if( data.error_code == 0 ){
						if( t ){
					    	notice.list = notice.list.concat( data.data.list );
						}
						else{
							notice.list = data.data.list;
						}
						if( notice.page_num == data.data.page_total ){
							notice.more = false;
						}
						else{
							if( data.data.list.length == 0 ){
								notice.more = false;
							}
							else{
								notice.more = true;
							}
						}
						notice.page_num ++;
					}
					else{
					    $.alert(data.error_msg);
					}
					notice.loading = false;
				} )
		},
		infinite: function(){
			$(document).on('infinite', '.infinite-scroll-bottom',function() {
				if( notice.more ){
					notice.getArticle( true );
				}
			});
			$.init();
		}
	})
	notice.getArticle();
	notice.infinite();
	avalon.scan( document.body )
</script>
</body>
</html>